<template>
  <div class="search">
    <f-form ref="form" :action="api.bcb" :form-key="this.formItem.companyBalancelogId" >
      <f-form-item label=""  name="companyBalanceId" dataType="${formField.dataType}"   :value="formItem.companyBalanceId" />
      <f-form-item label=""  name="logTitle" dataType="${formField.dataType}"   :value="formItem.logTitle" />
      <f-form-item label=""  name="logBody" dataType="${formField.dataType}"   :value="formItem.logBody" />
      <f-form-item label="日志类型"  name="logType" dataType="number"   :value="formItem.logType" />
      <f-form-item label="金额"  name="amount" dataType="${formField.dataType}"   :value="formItem.amount" />
      <f-form-item label="是否真实付款"  name="isRealPay" dataType="number"   :value="formItem.isRealPay" />
      <f-form-item label="关联的业务类型"  name="businessType" dataType="${formField.dataType}"   :value="formItem.businessType" />
      <f-form-item label=""  name="businessId" dataType="${formField.dataType}"   :value="formItem.businessId" />
      <f-form-item label="操作类型"  name="optType" dataType="number"   :value="formItem.optType" />
      <f-form-item label="操作人"  name="optAccountId" dataType="${formField.dataType}"   :value="formItem.optAccountId" />
      <f-form-item label="创建时间"  name="createDate" dataType="${formField.dataType}"   :value="formItem.createDate" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bcbForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          companyBalancelogId: '',
          companyBalanceId: '',
          logTitle: '',
          logBody: '',
          logType: '',
          amount: '',
          isRealPay: '',
          businessType: '',
          businessId: '',
          optType: '',
          optAccountId: '',
          createDate: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.companyBalancelogId) {
          let params={
              companyBalancelogId:data.companyBalancelogId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
